import SwiftUI
import AVFoundation
import SPGlassKit

public struct GlassVideoPlayerExample: GlassExample {
    public static let componentID = "glass-video-player"
    /// An empty player: the repository ships no media file, so the example shows the states without a video.
    @State private var emptyPlayer = AVPlayer()

    public init() {}

    public var body: some View {
        ScrollView {
            VStack(alignment: .leading, spacing: 16) {
                Text("No player")
                    .font(.headline)
                GlassVideoPlayer(player: nil, accessibilityLabel: "Trailer")

                Text("Player without an item, 4:3")
                    .font(.headline)
                GlassVideoPlayer(player: emptyPlayer, aspectRatio: 4.0 / 3.0, accessibilityLabel: "Lecture recording")

                Text("Missing URL")
                    .font(.headline)
                GlassVideoPlayer(url: nil)

                Text("Sample data · give the player a real URL to see the system controls.")
                    .font(.caption)
                    .foregroundStyle(.secondary)
            }
            .padding()
        }
    }
}

#Preview("GlassVideoPlayer") { GlassVideoPlayerExample().glassTheme(.obsidian) }
